home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 2 / Mac Magazin and MacEasy Magazine CD - Issue 02.iso / Sharewarebibliothek / Applikationen / Alpha.5.81 folder / Help / Intro < prev    next >
Text File  |  1994-06-16  |  64KB  |  1,845 lines

  1. ==============================================================================
  2. == Copyright © 1990-1994 Pete Keleher. All Rights Reserved
  3. ==============================================================================
  4.  
  5. The Author(s) of this product are in no way liable for any direct or 
  6. indirect damage caused by the product. 
  7.  
  8. You may freely copy and distribute ALPHA, but please bear in mind that 
  9. ALPHA is Shareware. If you decide to keep it, please register your copy by 
  10. sending $25 to the author. Site licences are $200. Source licenses are also 
  11. available, inquire with the author. If you include an internet (or 
  12. Compuserve) address with your registration, I will notify you when new 
  13. versions become available. 
  14.  
  15. E-mail address:     pete@cs.rice.edu
  16. Snail-mail address: Pete Keleher
  17.                     1658 Bonnie Brae #2
  18.                     Houston, TX 77006
  19.  
  20. I am collecting user-written Tcl procs and XTCLs in public/Alpha/contrib on 
  21. cs.rice.edu. If you have written anything that you think may be of general 
  22. interest, please send it to me and I will make it available. 
  23.  
  24. Alpha contains source from main places, but in particular I'm grateful to 
  25. Ray Johnson and Tim Endres for their working on porting TCL to the mac.
  26.  
  27. Thanks to Masatsugu Nagata, Karl J. Smith, Tim Endres, Eric Sink, 
  28. David C. Black, Richard T. Austin, Tom Scavo, and Jerry Fowler. 
  29.  
  30.  
  31. What to do:   USE THE "Sections" MENU IN THIS FILE!. This file contains 
  32. "marks" that let you jump to different sections of this file. Mouse-down 
  33. on the box that says "Sections" and move to the section you need.
  34.  
  35. Alpha is a very powerful, multi-purpose editor that allows any program- 
  36. or user-defined function to be bound to any keystroke, or placed into 
  37. user-defined menus. Only the "File", "Edit", and "Search" menus are 
  38. predefined and immutable. The rest are defined in the startup file 
  39. ("AlphaBits.tcl") or files sourced from inside it. 
  40.  
  41. Alpha uses Dr. Ousterhout's Tool Command Language (Tcl) as an extension 
  42. language. See the "Help" menu for a complete definition of the language. 
  43. Alpha uses a port of Tcl done by Tim Endres for his "Tickle" application, 
  44. and supports many of the same extensions. Many of the functions bound to 
  45. keystrokes, as well as many of the functions in the user-defined menus, are 
  46. written in Tcl. 
  47.  
  48. Callable functions in Alpha come in three different flavors. First, there 
  49. are the basic Alpha editor functions; these are discussed in the section 
  50. entitled "Simple Cmds" below. These functions take no arguments and do 
  51. not return values.
  52.  
  53. Second, there are additional Tcl extensions discussed in the "Alpha Tcl 
  54. Extensions" help file (look in the "Help" menu). Most of these functions 
  55. either take arguments or return values. 
  56.  
  57. Finally, there are the Tcl functions defined with "proc". Most of Alpha's 
  58. predefined functions are in "procs.tcl", some are in "shell.tcl". 
  59.  
  60. The only way to get to know the editor and the language is to try different 
  61. things out. Play around. Choose "Misc:List Bindings" to get a listing of 
  62. all the current keystoke bindings. Look in "procs.tcl" for definitions of 
  63. the routines. Look in "AlphaBits.tcl" for definitions of the last six 
  64. menus. And finally, please feel free to send suggestions/"feature" 
  65. reports/questions to me at pete@cs.rice.edu. I am not able to answer US 
  66. postal mail, but if you send it to me I will at least read it. Have fun! 
  67.  
  68.  
  69.  
  70. ==============================================================================
  71. == Colorizing
  72. ==============================================================================
  73. Version 5.80 and up support automatic "colorizing" of text. This is 
  74. controlled by the function 'regModeKeywords', which registers keywords to 
  75. colorize in a specific mode. By default, color schemes are supplied for 
  76. C, C++, Tcl, and TeX. Colorizing can be turned off via the 'coloring' 
  77. flag. 
  78.  
  79.  
  80. ==============================================================================
  81. == Reading and Storing Files
  82. ==============================================================================
  83. The primary method of either reading or storing files with Alpha, or any 
  84. other Mac editor, is through the GetFile and PutFile dialogs. However, 
  85. Alpha's dialogs are not exactly like those of other applications. 
  86.  
  87. The GetFile dialog has two additional items: a "Readonly" checkbox and an 
  88. "All Files" checkbox. The first allows you to open a file as read only. 
  89. Files in the readonly state can not be modified, only read. A writable file 
  90. is indicated by a pen icon to the left of the horizontal scrollbar. A 
  91. readonly file is indicated by a pen with a line through it. If you change 
  92. your mind about the file, it's readonly status can be changed by clicking 
  93. on the pen icon. 
  94.  
  95. The second checkbox, "All Files", allows Alpha to open any file rather 
  96. than just those of type 'TEXT'. The type of a file can be determined by 
  97. using the 'll' alias in the Tcl shell.
  98.  
  99.  
  100. The PutFile dialog is used to prompt the user for a new name under which to 
  101. save the contents of a window. This dialog has been enhanced by two popup 
  102. menus: "State" and "Format". "State" allows you to specify how much 
  103. information should be saved in the resource fork of files that you use. If 
  104. the state is set to "MPW", window position, current selection, tab sizes, 
  105. and font information are saved into the resource fork of your application 
  106. every time you open and close it, *even if you don't modify the file*. 
  107. Alpha still manages to coexist with build or make files because saving this 
  108. information does not change the modification date of the file. If the state 
  109. is set to "Think", neither the window position nor the current selection 
  110. are saved. If state is set to "None", no information is saved. The default 
  111. value for saved state can by changed by setting the Alpha variable 
  112. 'savedState' to "mpw", "think", or "none". Note that if a given file 
  113. already has mpw information in it when the file is open, Alpha will always 
  114. update that information when the file is closed. Note also that "marks" 
  115. are always saved in the resource fork whenever a file is saved, 
  116. regardless of the setting of the 'savedState' variable.
  117.  
  118. The "Format" menus allows the way Alpha terminates lines to be changed. 
  119. The Mac uses a carriage return to mark the end of a line, Unix uses a 
  120. linefeed, and IBM uses both (of course). Alpha can read and write any of 
  121. these formats, and can convert between them just by opening a file, 
  122. choosing "Save As", and changing the selection in this menu. Note that if 
  123. you are going to be sharing files with a Unix or IBM machine, you 
  124. probably don't want anything in your resource fork, so you'd probably 
  125. want to set 'savedState' to 'none' in your AlphaBits.tcl file.
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132. ==============================================================================
  133. == The Window
  134. ==============================================================================
  135.  
  136. Alpha's windows have several non-standard features. 
  137.  
  138. First, on the title bar at the left, there are either one or two boxes. If 
  139. there is only one box, the box implements a popup menu of all marks set in 
  140. the file. If there are two boxes, the left box implements a popup menu of 
  141. all functions in the current file (as defined by the 'funcExpr' regular 
  142. expression) and the right box implements the mark menu. These boxes can 
  143. be turned off via the flag 'showMenuHeads' in the "Utils:Flags" submenu. 
  144.  
  145. On the right of the titlebar, there is a running display of the current 
  146. row and column. These boxes can be turned off via the 'showRowCol' flag.
  147.  
  148. All title-bar boxes are turned off when Alpha is using full names for 
  149. window titles.
  150.  
  151. At the bottom of the window, the first box is a status display area. 
  152. Also, "Utils:Execute…" prompts for a Tcl expression in this space. To the 
  153. right of the status area is an icon displaying the readonly status of the 
  154. file. If the icon is just a pen, the file is writable. If the icon is a 
  155. pen w/ a bar through it, the file is not writable. The readonly status of 
  156. the window can be toggled by clicking on the icon.
  157.  
  158. To the right of the readonly icon area is the mode display area. Alpha 
  159. allows you to have any number of different modes, w/ different bindings 
  160. and behavior in each. The mode display not only shows the current mode, 
  161. but also implements a popup menu allowing you to change the current mode 
  162. for the window.
  163.  
  164. ==============================================================================
  165. == Marks
  166. ==============================================================================
  167.  
  168.  
  169. Alpha allows the user to use "marks" to remember positions in files. Marks 
  170. "float". That is, if a mark is initially at position 312 and then five 
  171. characters are inserted at location 297, the mark's new value will be 317. 
  172. Alpha uses three different types of marks. 
  173.  
  174. The first is generically referred to as "the mark". The mark is set to the 
  175. current insertion point by the command 'setMark' (control-space by 
  176. default). The position in the file indicated by the blinking cursor is 
  177. referred to as the current insertion point. Many commands (such as "cut" 
  178. and "copy") can operate either on the currently selected (hilighted) text, 
  179. or the text between the current insertion point and "the mark". For 
  180. example, if you move the cursor to the beginning of the work "allybaba", 
  181. hit command-space (the status bar should say "Mark set"), move to the end 
  182. of the word and hit option-w (the status bar should say "Region copied"), 
  183. the effect is the same as if you had used the mouse to select the text and 
  184. then selected the "Copy" command from the "Edit" menu.
  185.  
  186. The second type of mark are the permanent marks. Permanent marks are set, 
  187. removed, and moved-to through the three corresponding menu items in the 
  188. "Search" menu. Permanent marks differ from the generic mark in that they 
  189. have names, there can be any number of them, and they are saved in the 
  190. resource fork if the file is subsequently saved.
  191.  
  192. The third type of mark is the temporary mark. Like permanent marks, 
  193. temporary marks can be named and there can be any number of them. Unlike 
  194. permanent marks, temporary marks do not "dirty" the file, and they aren't 
  195. saved. So far, temporary marks are used exclusively to implement higher 
  196. order functions in TCL procedures. In the 5.0 release, temporary marks are 
  197. used to implement a "mark stack" and a for loop template.
  198.  
  199. At the time a file is saved, the marks for that file are stored into the 
  200. file's resource fork in an order determined by the variable 
  201. 'markSorting'. The choices are either 0 (no sorting), 1 (sort by file 
  202. position), or 2 (sort alphabetically).
  203.  
  204.  
  205. ==============================================================================
  206. == The Mark Stack
  207. ==============================================================================
  208.  
  209. The mark stack is a last-in-first-out (LIFO) stack of temporary marks 
  210. managed by the TCL procedures 'pushMark' and 'popMark'. 'pushMark' creates 
  211. a new temporary mark of the current insertion point and adds it on to the 
  212. top of the stack. 'popMark' removes the top mark from the stack and goes 
  213. toit. A typical use of the mark stack is a 'pushMark' at the current 
  214. position, go look somewhere else in the file, and then 'popMark' to get 
  215. back to where you were. However, the stack is recursive, so there can be 
  216. any number of 'pushMarks' before the marks start to be popped back off the 
  217. stack.
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242. ==============================================================================
  243. == Templates
  244. ==============================================================================
  245.  
  246. Temporary marks can also be used to with language construct templates. The 
  247. file "template.tcl" contains an example implementing a template for C's 
  248. 'for' command. Depressing control-i will insert a template for the "for" 
  249. command into the current window. Five temporary marks are defined in the 
  250. for structure, three inside the parenthesis, one where the "for" body text 
  251. will be inserted, and one after outside the for body entirely. Depressing 
  252. control-shift-i moves the cursor to the next of the five temporary marks 
  253. allowing quick entry of the entire command.
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279. ==============================================================================
  280. == The Tool Command Language (TCL)
  281. ==============================================================================
  282.  
  283. See the Tcl manual page under the 'Help' menu for a complete description of 
  284. Tcl, the Tcl shell, and it's commands. Each of the Tcl commands and several 
  285. sections have a mark defined, so you can use the "Mark" titlebar menu to 
  286. navigate through the manual page. If you define the file
  287. ":Tcl:UserCode:userStartup.tcl", Alpha will load it at startup.
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317. ==============================================================================
  318. == Key Bindings
  319. ==============================================================================
  320.  
  321.  
  322. Any TCL command can be bound to any single keystroke. One way to bind a 
  323. function is with a statement such as:
  324.   
  325.       bind 'c' <modifier string> funcName [<mode>]
  326.           
  327. where c is a character, <modifier string> is an optional string containing 
  328. one or more of:
  329.  
  330.       c   - command modifier
  331.       o   - option modifier
  332.       s   - shift modifier
  333.       z   - control modifier
  334.       e   - escape modifier      
  335.  
  336. Additionally, the modifier string can contain a capital letter specifying 
  337. that the binding is only activated if preceded by control and the lowercase 
  338. version of that letter. This feature allows multiple-key combinations ala 
  339. Emacs. The following line binds cmd-shift-f to the function 'forwardChar': 
  340.  
  341.  bind 'f' <cs> forwardChar 
  342.  
  343. The next line would bind the same function to C-x C-f: 
  344.  
  345.  bind 'f' <cX> forwardChar 
  346.  
  347. 'mode' is an optional parameter that specifies, when present, that the 
  348. binding is only active in a given mode, where the current mode is the 
  349. parameter to the last call of 'displayMode' (look in "procs.tcl"). Note 
  350. that given a general binding (no mode specification) and a binding specific 
  351. to the current mode, the last binding to have been created is the one found 
  352. first. 
  353.  
  354. Additionally, most keyboards have keypads and/or Function Keys. These 
  355. keys can be bound using case-insensitive numeric labels using the same 
  356. bind command as above, with the label replacing the character. For 
  357. example, to bind F1 to function 'funcName', the following would work:
  358.  
  359.     bind F1 funcName
  360.  
  361. As above, the binding can include a modifier string. The following labels 
  362. are defined for US keyboards:
  363.  
  364.   Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 Help Home Pgup Del 
  365.   End Pgdn Left Right Up Down Clear Kpad0 Kpad1 Kpad2 Kpad3 Kpad4 Kpad5
  366.   Kpad6 Kpad7 Kpad8 Kpad9 Kpad= Kpad/ Kpad* Kpad- Kpad+ Enter Kpad.
  367.  
  368. The function 'listBindings' will list all of the bindings currently in 
  369. effect in a format suitable for re-loading.
  370.  
  371. The above labels may not be sufficient for all keyboards (attention 
  372. international users). If a hex number is used instead of a character inside 
  373. the single quotes, the binding is done to key codes instead of ascii 
  374. values. The following is a key code version of the same binding: 
  375.  
  376.       bind 0x03 <cs> forwardChar
  377.  
  378. The key code for any given key can be obtained by using the 'keyCode' 
  379. function. 
  380.  
  381. Also, there is an alternate form that allows the specification of an 
  382. ascii code directly:
  383.  
  384.     ascii 0x20 <z> setMark
  385.     
  386. Binds control-space to 'setMark'.
  387.  
  388. Note that menu item command equivalents take precedence over bindings, 
  389. and that the 'bind' command does not affect the command equivalents 
  390. displayed in the menus. Command equivalents can only be changed by using
  391. an external tool like 'ResEdit'. Also note that key code bindings take 
  392. precedence over ascii bindings. 
  393.  
  394. Finally, there is an 'unbind' key, with the same arguments as bind except 
  395. for the function argument. The function is the following is the syntax:
  396.  
  397.       unbind 'c' <modifier string> [<mode>]
  398.  
  399.  
  400.  
  401. ==============================================================================
  402. == Menus
  403. ==============================================================================
  404.  
  405. Alpha's menus are completely reconfigurable. Some of the menu items are 
  406. internal alpha commands, while others are Tcl procs defined in one of the 
  407. files of the "Tcl" subdirectory. Most of these procs are defined in 
  408. "procs.tcl". The following is an explanation of the default menus. The 
  409. explanations of items that are defined as Tcl procs are implemented by the 
  410. Tcl proc specified by "(proc <name>)", and can be found in one of the .tcl 
  411. files. All others are internal functions. 
  412.  
  413. File
  414.     New                      New file.
  415.     Open…                   Open file.
  416.     Close                   Close file.
  417.     File Sets            
  418.         Choose                Set current fileset.
  419.         Create Fileset        Create a fileset on the fly.
  420.         Create Think Fileset Create a fileset containing the source files
  421.                             of a THINK 7.0 project.
  422.         Dump Fileset        Dump a fileset definition into the current window.
  423.         Edit File            Edit a file from one of the filesets.
  424.         Find Tag            Find a function definition.
  425.         Create Tag File        Create a "tag" file specifying where functions
  426.                             are defined.
  427.     Save                       Save file.
  428.     SaveAs…                   Prompt for name to same file under.
  429.     Revert                   Revert to last saved version, throw away undo history. 
  430.     Shell                   Start up command-line shell that interprets Tcl commands. The 
  431.                             shell has a few csh-type features, such as 'ls', 'rm', etc. 
  432.                             commands, as well as file completion with the TAB key. 
  433.     Page Setup…               Set print options.
  434.     Print…                  Print file.
  435.     Quit                       Quit Alpha.
  436.  
  437. Edit
  438.     Undo                    Undo. 
  439.     Redo                    Redo. 
  440.     Load Window
  441.     Load Selection            Execute either the window or the selection as Tcl source. 
  442.     Cut                        Cut selection to scrap.
  443.     Copy                    Copy selection to scrap.
  444.     Paste                    Paste from scrap.
  445.     Paste Pop                Immediately after a paste, use a previous paste instead.
  446.     Yank                    Paste last deleted text. Concatenates together consecutive, 
  447.                             adjoining deletions.
  448.     Select All                Select entire file.
  449.     Clear                    Delete selection.
  450.     Shift Left                Shift selection left one tab.
  451.     Shift Right                Shift selection right one tab.
  452.     Balance                    Select text out to the next set of matching braces.
  453.     
  454. Search
  455.     Find..                    Present a search dialog.
  456.     Repeat Search Forward    Search forward again w/ same settings.
  457.     Repeat Search Backward    Search backward again w/ same settings.
  458.     Find in Next File        Restart multiple-file search in next file after 
  459.                             stopping at a match.
  460.     Enter Selection            Make the current selection the text to be searched for.
  461.  
  462.     Replace                    Replace the selection.
  463.     Replace and Find Again.    Replace the selection and search again forward.
  464.     Replace All                Replace all of occurances of the search string in the rest 
  465.                             of the file.
  466.     Goto Line…                Go to specific line.
  467.     Named Marks
  468.         Set…
  469.         Goto…
  470.         Remove…
  471.     Unnamed Marks
  472.         Set…
  473.         Exchange Point and Mark
  474.         Hilite                Select text between current insertion and the generic "mark". 
  475.                             Or, if there is already a selection, unselect the text, place
  476.                             the insertion at the beginning of the unselection, and place the 
  477.                             "mark" at the end of the unselection. The function 
  478.                             'exchangePointAndMark' (by default mapped to the "5" on the keypad 
  479.                             and control-x,control-x) exchanges the character positions of the 
  480.                             insertion and the "mark". 
  481.     Mark Stack
  482.         Push                Push current pos onto a "stack".
  483.         Pop                    Pop last pos from stack and go to it.
  484.         
  485.     
  486. Utils
  487.     Flags                    A submenu of Tcl flags to be turned on and off. Look under 
  488.                             "Variables" for explanations of individual flags (proc editFlag).
  489.     Vars                    Same as Flags, except these variables may be arbitrary integers 
  490.                             or strings (proc editVar).
  491.     File Utils
  492.         Insert Path Name…    Prompt for a file and insert complete pathname in window.
  493.         Insert File…        Insert the text of another file.
  494.         File Remove…        Remove a file.
  495.         File Info…            Display/edit info about a file.
  496.         Word Count            Count lines, words, chars in window (proc wordCount).
  497.  
  498.     Evaluate…                Evaluate complex command.
  499.     Kbd Macros
  500.         Start Keyboard Macro    Start creating anonymous macro.
  501.         End Keyboard Macro        Finish.
  502.         Execute Keyboard Macro    Execute.
  503.         Dump Macro                Dump to current file.
  504.  
  505.     Spellcheck Window
  506.     Select Paragraph
  507.     Named Clipboards
  508.         Copy…
  509.         Cut…
  510.         Paste…
  511.         
  512.  
  513. Mode
  514.     Set Mode Menus            Decide which menus will pop up during this mode.
  515.  
  516.     Describe Binding…        Wait for a keystroke, then display that keystroke's binding.
  517.     List Bindings            Create a new file containing all current key bindings.
  518.     Ascii Etc
  519.         Key Code…            Wait for key press and insert keycode and modifier string 
  520.                             suitable for key binding.
  521.         Key Ascii…            Same as above, but use ascii form.
  522.         Get Ascii…            Display ascii code for char to right of insertion.
  523.         Insert Ascii…        Prompt for ascii code and insert character.
  524.  
  525.     Set Font Tabs…            Change font and/or tabs for current file.
  526.         
  527.     Switch To                Bring other apps to front.
  528.     ToolServer Shell        Start a window that sends 'DOSC' events to Apple's 
  529.                             toolserver. 
  530.     Load Electric Alias        Load David Black's 'electricAlias' package. See the 
  531.                             "Help" menu for more details (proc loadElectricAlias).
  532.     
  533.  
  534. Convert
  535.     Fill Region                "Fill" selection subject to 'leftFillColumn' and 
  536.                             'fillColumn', (proc fillRegion).
  537.     Fill Paragraph            "Fill" paragraph that contains the insertion (proc 
  538.                             fillParagraph).
  539.     Wrap Region                Break lines longer than 'fillColumn' in selection 
  540.                             (proc wrapRegion).
  541.     Wrap Paragraph            Break lines longer than 'fillColumn' in paragraph 
  542.                             containing insertion pt (proc wrapParagraph).
  543.     Sort Lines                Sort selected lines (proc sortLines).
  544.     Matching Lines            Grab all lines from current position on that match a 
  545.                             regular expression and dump in new buffer (proc matchingLines). 
  546.  
  547.     Zap Invisibles            Delete all chars in file w/ ASCII code < 32, except for 
  548.                             LF, TAB and CR.
  549.     Tabs To Spaces            Convert tabs to space runs.
  550.     Spaces To Tabs            Convert space runs to tabs.
  551.  
  552.     Strings
  553.         Insert Prefix        Prepend string 'prefixString' to every line in selection 
  554.                             (proc insertPrefix).
  555.         Insert Suffix        Append string 'suffixString' to every line in selection 
  556.                             (proc insertSuffix).
  557.         Remove Prefix        Remove prefix string from lines in selection 
  558.                             (proc removePrefix). 
  559.         Remove Suffix        Remove suffix string from lines in selection 
  560.                             (proc removeSuffix). 
  561.         Set Prefix…            Change prefix string (proc setPrefix).
  562.         Set Suffix…            Change suffix string (proc setSuffix).
  563.     Comment
  564.         Transpose Chars        Transpose two chars around cursor.
  565.         Transpose Words        Transpose two words around cursor.
  566.         Comment Box            Create a comment box around selected text.
  567.         UnComment Box        Remove such a comment box.
  568.         
  569.     Filters
  570.         Replace In Region
  571.         Filter Lines
  572.         Filter Paragraphs
  573.         Sort Paragraphs
  574.         Fill Region By Par
  575.         Line To Paragraph        Convert long line to paragraph, useful for importing 
  576.                                 text from word processors (proc lineToParagraph).
  577.         Paragraph To Line        Convert paragraph to single long line, useful for 
  578.                                 exporting text to word processors (proc paragraphToLine).
  579.     Downcase Region            Downcase all chars in region.
  580.     Upcase Region            Upcase all chars in region.
  581.  
  582.  
  583. Help
  584.     Editor help files (proc helpMenu).
  585.     
  586. Wins
  587.     Arrange                    Rearrange open windows.
  588.  
  589.     Zoom                    Zoom windows in and out.
  590.     Iconify                    Replace window w/ small icon (proc iconify).
  591.     Toggle Scrollbar        Toggle the horizontal scrollbar on the frontmost 
  592.                             window. The scrollbar can be enabled/disabled on subsequent 
  593.                             variables by changing the value of the 'horScrollBar' flag.
  594.  
  595.     Next Window                Select next window (proc nextWindow).
  596.     Swap With Next            Swap topmost two windows (proc swapWithNext).
  597.     Choose A Window            Choose window to select from list (proc chooseAWindow).
  598.     Prev Window                Select previous window (proc prevWindow).
  599.     Close All                Close all windows (proc closeAll).
  600.     Save All                Save all dirty windows (proc saveAll).
  601.  
  602.     
  603.     
  604. ==============================================================================
  605. == User-Defined Menus
  606. ==============================================================================
  607.  
  608. All of Alpha's menus are defined in the initialization files that Alpha 
  609. loads on startup.  They can be altered or discarded at well.  Alpha's menu 
  610. commands allow the the user to build custom menus which contain names of 
  611. functions, macros, or arbitary TCL commands that just HAVE to be in the 
  612. menus, as opposed to being merely callable through the bindings.  The 
  613. syntax is dead simple.  Menus can be nested, allowing heirachical menus to 
  614. be defined.  See the 'AlphaBits.tcl' file for examples (only the first 
  615. three Alpha menus are hard-coded into the Application, the others are set 
  616. up through the AlphaBits file).  The following meta characters can be 
  617. embedded in the strings:
  618.  
  619.    Meta-character     Usage
  620.    --------------     -----
  621.  
  622.     ; or Return       Separates multiple items.
  623.     ^                 Followed by an icon number, adds 
  624.                       that icon to the item.
  625.     !                 Followed by a character, marks the
  626.                       item with that character.
  627.     <                 Followed by B, I, U, O, or S, sets 
  628.                       the character style of the item.
  629.     /                 Followed by a character, sets up
  630.                       a keyboard equivalent.
  631.     (                 Disables the item.
  632.  
  633. The menu creation syntax is :
  634.  
  635.     menu <-n name> <-i num> [-p procName] [-m] "Tcl list of items"
  636.  
  637. Where the arguments have the followings meanings:
  638.   '-i <num>'    Resource id of icon suite to use for menu title.
  639.   '-n <name>'    Name of menu.
  640.   '-m'            No menu form. If not supplied, each menu item is split into 
  641.                   words at each capitalized letter.
  642.   '-p <pname>'     Rather that having alpha call a Tcl proc named by the menu 
  643.                   item's text, this option tells Alpha to call the tcl proc named by 
  644.                   'pname' with two arguments: the menu name, and the text of the menu 
  645.                   item chosen.
  646.  
  647. Once the menus are created, they can be inserted and  deleted from the 
  648. menu bar by the syntax:
  649.  
  650.    insertMenu "name"
  651.    deleteMenu "name"
  652.  
  653. as well as through macros.
  654.  
  655.  
  656. As alluded to above, Alpha attempts to make procedure names readable in the 
  657. menus by separating words at any capitalized letter. For example, 
  658. 'findFile' becomes "Find File". This function is turned off by the '-m' 
  659. option. 
  660.  
  661. Menu items can be enabled and disabled through the TCL command 
  662. 'enableMenuItem'. Menu items checkmarks can be turned on and off via 
  663. 'markMenuItem'. Menu items can be appended via 'addMenuItem' and deleted 
  664. via 'deleteMenuItem'. See the "Alpha Tcl Extensions" help file for syntax. 
  665.  
  666. If an ellipsis ('…') is the last character in a menu item, it is stripped 
  667. off before searching for the function corresponding to the chosen item. 
  668.  
  669.  
  670. #================================================================================
  671. # Just for the heck of it, the following is a script that I put in my 
  672. # userStartup.tcl file. It creates a menu for all the .tex files in my 
  673. # thesis directory, minus the dirname and .tex extension.
  674. #
  675. set THESIS "Internal:Textures:thesis"
  676. proc thesisMenuProc {menu item} {
  677.     global THESIS
  678.     edit -r -m $THESIS:$item.tex
  679. }
  680.  
  681. set files ""
  682. foreach f [glob $THESIS:*.tex] {
  683.     lappend files [file rootname [file tail $f]]
  684. }
  685. menu -n Thesis -m -p thesisMenuProc $files
  686. unset files
  687. #================================================================================
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697. ==============================================================================
  698. == Event Hooks
  699. ==============================================================================
  700.  
  701.  
  702. Alpha calls the TCL procs "openHook", "saveHook", "saveasHook", "closeHook", 
  703. "activateHook", "deactivateHook", "suspendHook", and "resumeHook" when the 
  704. corresponding events occur. With the exception of "saveasHook", the proc 
  705. are all called with the complete pathname as the sole argument. 
  706. "saveasHook" is called with the old pathname as the first argument and the 
  707. new pathname as the second argument. Default implementations for these 
  708. commands are in the file 'proc.tcl'. These commands can be modified to 
  709. perform arbitrary commands, including saving of files, backups, 
  710. implementations of per-window variables, etc. 
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738. ==============================================================================
  739. == Searching
  740. ==============================================================================
  741.  
  742.  
  743. ALPHA has a full repertoire of searching commands.  The 'find' command 
  744. brings up a dialog allowing the search and replacement text to be 
  745. specified.  The dialog also allows 'Forward', 'Ignore Case', 'Reg Expr', 
  746. and 'Word Match' options to be set.  These options can be toggled via the 
  747. keyboard by clover-<first letter of option>.  For example, clover-w toggles 
  748. the 'Word Match' option.
  749.  
  750. The 'Mult Files' option tells Alpha to search through all files in a given 
  751. file set.  Filesets can be specified in 'procs.tcl' (see the section on 
  752. filesets) or on the fly, via the "Add Fileset…" item of the "Utils" menu. 
  753. Filesets can be chosen via the popup fileset menu.
  754.  
  755. In addition to the current filesets, the fileset menu has an entry called 
  756. "Directory Scan". Selecting this menu item enables the "Scan Options" 
  757. button. This button, in turn, allows the specification of a directory and 
  758. a file pattern to be searched instead of a fileset. To set the directory, 
  759. hit the "Dir:" button. The pattern is used to select files of the 
  760. selected directory. The '*' wildcard character can be used to replace any 
  761. sequence of characters. For example, the pattern '*.c' will select any 
  762. file ending with ".c". If this doesn't work, be sure that you executed 
  763. all of the following steps:
  764.         1) select "Directory Scan" in the popup menu of the find dialog
  765.         2) Hit the "Scan Options" button.
  766.         3) Select a directory via the "Dir:" button.
  767.  
  768. And finally, Alpha allows a library of useful search and replace texts to 
  769. be defined as a tcl list of lists (each sublist containing a name, search 
  770. text, and replacement text). This list, the 'patternLibrary' variable 
  771. defined at the end of 'procs.tcl', is used to create a popup menu in the 
  772. find dialog allowing these patterns to be easily entered.
  773.  
  774. Once the text and options have been set, the 'Search' menu contains several 
  775. commands for repeated searching, replacing, etc. 
  776.  
  777.  
  778. ==============================================================================
  779. == Regular Expressions
  780. ==============================================================================
  781.  
  782. If the variable 'regExpr' is true, the search functions interpret the 
  783. search text as regular expressions, which have the following elements:
  784.  
  785.  c        literal char.
  786.  ^        beginning of line.
  787.  $        end of line.
  788.  .        any character except carriage return.
  789.  [...]    character class, can use ranges such as '0-9'.
  790.           inside classes. Matches one character of the 
  791.           enclosed choices. Ex: '[ac0-2]' matches 'a', 
  792.           'c', '0', '1', or '2'.
  793.  [^...]   negated character class, matches anything but
  794.           the enclosed characters. ']' can be included
  795.           by putting it immediately after the '^'.
  796.  \t       tab.
  797.  \r       carriage return or line break.
  798.  *        zero or more occurrences of the previous
  799.           pattern. Ex: 'ab*' matches 'a', 'ab', 'abb',
  800.           'abbb' etc.
  801.  +        one or more occurrences of the previous 
  802.           pattern. 
  803.  ?        zero or one occurrences of the previous 
  804.           pattern. Ex: 'ab?' matches 'a' or 'ab'.
  805.  a|b      matches either a or b. If enclosed in
  806.           parenthesis, the extent of the alternated
  807.           expressions is limited. Ex: (pete|bob) 
  808.           matches either 'pete' or 'bob'.
  809.  (...)    The interior elements are grouped together. 
  810.  
  811. Regular expressions constructed from the above elements can be 
  812. concatenated to create larger expressions. 
  813.  
  814. The parenthesis also define substrings of the total matched string that 
  815. can be used either later during substitution. The substring delimited by 
  816. the pair of parenthesis that includes the nth left paren is denoted \n, 
  817. where n is 1, 2, .... 9.  '\0' and '&' both refer to the matched text.
  818.  
  819. EXAMPLE: 
  820. The following regular expression will match either 'aabox' or 'bbbox':
  821.  
  822.               (aa|bb)box
  823.  
  824. Regular expressions can be very difficult to master, but they the 
  825. following section shows how useful they can be.
  826.  
  827. The text used in searches and replaces can be accessed through the alpha 
  828. variables 'searchStr' and 'replaceStr'.
  829.  
  830.  
  831. ==============================================================================
  832. == Incremental Searches
  833. ==============================================================================
  834.  
  835. Emacs users will be happy that both forward and backward incremental 
  836. searches are implemented. Incremental searches bypass the normal search 
  837. dialog and search for the current text after each keystroke. The result is 
  838. often much faster and less intrusive. Executing either while an incremental 
  839. search is in progress causes the search to proceed to the next instance of 
  840. the current text. Incremental search mode is exited when any other command 
  841. (executed through the menus or through bindings that include at least one of 
  842. the control key and the option key) is executed, or when the escape or 
  843. delete key is used. Typing control-w while incremental search is active 
  844. causes all the characters to the end of the next word boundary to be 
  845. added to the search.
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871. ==============================================================================
  872. == 'C' Tags
  873. ==============================================================================
  874.  
  875.  
  876. ALPHA supports the use of tags to find declarations of functions. When 
  877. searching for a tag, ALPHA looks for the tag file specified by the 
  878. "tagFile" string variable. ALPHA's tag generating routines use the regular 
  879. expression in the string variable "funcExpr" to look for function 
  880. declarations. In other words, we don't parse the text. If you declare your 
  881. functions differently, you can change " funcExpr" to suit your own style. 
  882. Alpha currently uses the following regular expression to find C function 
  883. declarations:
  884.  
  885.               ^[^ \t#\r/@][^\r]*\([^\r]*\)$
  886.  
  887. (NOTE: the above expressions won't pick up many C++ method definitions. To 
  888. pick them up, add a question mark '?' after the last right parenthesis.) 
  889. Although complicated, this expression makes sense if you slowly wade 
  890. through it. The string that we are looking for must take up an entire 
  891. line. It must begin with a character other than '\t', '#', '\r', '/', ' ', 
  892. or '@'. There must be a set of parenthesis.   
  893.  
  894. Note that not only can you customize this to your style of 'C' 
  895. declarations, you could also use it to generate tags for other languages. 
  896. The only thing you need to bear in mind is that the tag routines use the 
  897. complete word previous to the first '(' in the selected line as the 
  898. function's name. If there is no '(' in the selected line, the last word in 
  899. the line is used. Therefore, Pascal procedures w/ or w/o parameters can be 
  900. identified.
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908. ================================================================================
  909. == Backups
  910. ================================================================================
  911. If the 'backup' variable is set in userStartup.tcl, or from the 
  912. Utils:Flags menu, Alpha backs up each file before saving new 
  913. modifications. By default, the backup file is in the same directory, and 
  914. its name is formed by suffixing a tilde to the name of the saved file. 
  915. Backups are actually performed in the 'saveHook' proc (see above), in the 
  916. file procs.tcl. The Tcl variables 'backDir' and 'backExtension' can be 
  917. used to modify this behavior.
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945. ==============================================================================
  946. == "Fill" Routines
  947. ==============================================================================
  948.  
  949.  
  950. The "fill" and "wrap" routines reformat text to specified line lengths. 
  951. This is useful in two case. First, word processors such as Microsoft Word 
  952. only insert carriage returns at the end of paragraphs. Secondly, while 
  953. typing and inserting text into pre-existing paragraphs, the line lengths 
  954. become unequal. 
  955.  
  956. The "wrap" routine handles word processor documents quickly by merely 
  957. inserting carriage returns as necessary to ensure all lines in the 
  958. selected region are shorter than specified by the variable 'fillColumn'. 
  959. Alpha asks the user if wrapping should be done whenever the user opens 
  960. files that have lines longer than 'paraColumn' characters.
  961.  
  962. The TCL routines 'fillRegion' and 'fillParagraph' go further. Not only do 
  963. they break lines, but they also coalesce lines to eliminate short lines. 
  964. Both routines work by stripping the relevent text of white space, then 
  965. re-inserting white space and carriage returns so that no line extends past 
  966. 'fillColumn' characters in length and begins with 'leftFillColumn' spaces 
  967. characters. Both routines are implemented in the file 'procs.tcl', and 
  968. therefore different definitions of paragraphs can be accomodated by 
  969. modifying the appropriate TCL procedures.
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983. ==============================================================================
  984. == Titlebar Menus
  985. ==============================================================================
  986.  
  987.  
  988. If the value of the variable 'showMenuHeads' is non-zero, every text window 
  989. contains two boxes in the title bar.  By default, the first contains a box 
  990. entitled "Func".  Depressing the mouse in this box bring up a popup menu 
  991. containing a "Mark File" item, followed by a separator, followed by all the 
  992. permanent marks in the file.  "Mark File" causes Alpha to call the tcl 
  993. proc 'markFile'. This routine, depending on the mode, calls a 
  994. mode-specific routine to create a list of marks definining all the 
  995. procedures or sections in the file. In order to remove any extraneous 
  996. marks, remove all marks in the file (via "Search:Named Marks:Remove…" and 
  997. selecting "All"). 
  998.  
  999. The second box contains the current row and column. Clicking in this box 
  1000. brings up a goto-line dialog.
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023. ==============================================================================
  1024. == Word Breaking
  1025. ==============================================================================
  1026.  
  1027. Alpha allows you to redefine it's internal notion of what a word is, 
  1028. through the variables 'wordBreak', and 'wordBreakPreface'. 'wordBreak' is 
  1029. set to a regular expression that defines a word to you. 'wordBreakPreface' 
  1030. should be a regular expression that matches exactly one of any characters 
  1031. that are not in your word definition. 
  1032.  
  1033. For instance, the default definition of 'wordBreak' is '[a-zA-Z0-9_]+'. 
  1034. This matches any contiguous sequence of contiguous alphanumeric 
  1035. characters, plus underscore.
  1036.  
  1037. The default value for wordBreakPreface is '[^a-zA-Z0-9_]', basically just 
  1038. the negation of any any of the characters in your 'wordBreak' definition. 
  1039.  
  1040. The need for both these variables in backward searches can be seen as 
  1041. follows. Suppose your window's text is "hey hello", and the current 
  1042. insertion is between the two 'l's. Now, searching backwards for the above 
  1043. 'wordBreak' definition will take the insertion to between the 'e' and the 
  1044. first 'l', not really where we want to say is the start of the word. By 
  1045. contrast, if we search backwards for 'wordBreak' and 'wordBreakPreface' 
  1046. concatenated together, and then move forward one character after a 
  1047. successful search, we end up right before the 'h' in 'hello', just where 
  1048. we want to be.
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064. ==============================================================================
  1065. == Defining and Using File Sets
  1066. ==============================================================================
  1067.  
  1068. File Sets are lists of files that Alpha uses for multiple-file searches and 
  1069. tag searches, among other things. Typically, a user will set up several 
  1070. different file sets in the AlphaBits.tcl file, perhaps one specifying all 
  1071. the source files in a project, another specifying all the Mac include 
  1072. files, and another specifying all the UNIX include files. When a command 
  1073. using file sets is initiated, Alpha evaluates the command "getCurrFileSet", 
  1074. which returns a list of complete pathnames to search. Some of the lists are 
  1075. set up explicitly (see the 'noGlobNecessary' definition in "procs.tcl"), 
  1076. while other file sets are defined at startup time through the use of file 
  1077. globbing. See the TCL manual page for a definition of "glob"ing. The 
  1078. definition of the variable "globNecessary" in "procs.tcl" shows how to to 
  1079. this. 
  1080.  
  1081. Functions that use file sets operate on the "current" fileset, which is 
  1082. specified by the 'fileSet' variable. The current file set can also be 
  1083. switched by using  the "File Set" heirarchical menu. 
  1084.  
  1085.  
  1086. 5.02 includes a new Tcl proc 'addFileset', which allows a fileset to be 
  1087. created on the fly. This 
  1088. fileset remains usable until Alpha is restarted. It should be quite simple 
  1089. to use Tcl to make this new fileset permanent. A Tcl proc could also be 
  1090. written to create a heirarchical menus that has a submenu for each fileset, 
  1091. the items of each submenu being the files for that fileset. However, I'm 
  1092. not going to write everything... 
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107. =============================================================================
  1108. == Keyboard Macros
  1109. =============================================================================
  1110.  
  1111.  
  1112. Defining and Using Keyboard Macros ALPHA supports keyboard macros which 
  1113. record a sequence of keystrokes to be played back later w/ the function 
  1114. 'executeKeyboardMacro' (this function is also in the 'Utilities' menu) or 
  1115. written into a buffer by selecting 'Dump Macro' from the 'Utilities' menu. 
  1116. The dump function prompts you for a macro name, which must consist only of 
  1117. letters of the alphabet, digits, and '_'. 
  1118.  
  1119. These macro declarations can then be edited, loaded, and bound to 
  1120. keystrokes. Loading a macro or a binding is accomplished by hiliting the 
  1121. text and selecting the "Load Selection" item of the 'Customize' window. If 
  1122. no text is hilited, the entire window is loaded by the same command. 
  1123. Macros can be bound to keys in exactly the same manner as functions (see 
  1124. above). 
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144. =============================================================================
  1145. == Undo + Redo
  1146. =============================================================================
  1147.  
  1148.  
  1149. ALPHA supports unlimited undo and redo. This means that most changes can 
  1150. be undone, and then redone, at will. Bear in mind that once you create new 
  1151. modifications, all changes that you have undone but not redone are lost. 
  1152. Another point to bear in mind is that saving a buffer to disk currently 
  1153. flushes the undo buffer. 
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181. =============================================================================
  1182. == Think 6.0
  1183. =============================================================================
  1184.  
  1185. Yes! Finally Think has support for external editors. To make this work, 
  1186. put an alias of Alpha (version 5.5 or later) in the "Tools" subdirectory 
  1187. of the directory the project manager is in, and name the alias "Editor". 
  1188. Secondly, check the "Use External Editor" button in the project manager's 
  1189. option dialog. Finally, check the "Always Check File Dates" button.
  1190.  
  1191. Any open window events will now be vectored to Alpha, and from within 
  1192. Alpha you can initiate compiles, disassembles, makes, etc. Errors are 
  1193. reported back to Alpha displayed in a window titled "Browser". The only 
  1194. useful things to do in the browser window are to select the error you 
  1195. want (by moving up and down w/ the arrow keys), and telling Alpha to 
  1196. display the error by hitting return or Enter on the correct line. 
  1197.  
  1198. Caveats and comments:
  1199.     1) This is all very shaky right now, I'm currently short of time.
  1200.     2) Think's event support isn't all there. In particular, I've 
  1201.        seen some bombs caused entirely by the project manager, and the 
  1202.        "Make" apple event doesn't appear to do anything.
  1203.     3) Think's debugger currently doesn't accept Apple Events telling it to 
  1204.        open a file and go to a specific line. This will change in the near 
  1205.        future. In the meantime, it is not possible to tell the debugger to 
  1206.        go to a specific line at all, when using an external editor. You CAN 
  1207.        go into think, select a file name from the project window (don't open 
  1208.        it) and go to the debugger from there. This gets the debugger to the 
  1209.        file you want, but not the correct line.
  1210.     4) Look in :Tcl:SystemCode:"think.tcl" and "browser.tcl" for the code 
  1211.        controlling much of the interactions between THINK and Alpha. If you 
  1212.        improve anything, please send it back to me.
  1213.  
  1214.  
  1215. For pre-6.0, after editing w/ Alpha hit the 'Use Disk' button from the 
  1216. 'Build' menu item to force Think to check modification times for a build. 
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240. =============================================================================
  1241. == Rectangular Editing
  1242. =============================================================================
  1243.  
  1244.  
  1245. If the option key is pressed while the mouse is dragged,  a rectangular 
  1246. section of text is selected instead of the normal selection. This 
  1247. rectangular selection may extend over multiple lines, but contains only 
  1248. text between the column of the drag start and the column of the drag end. 
  1249. The drag cannot end on a column or row less than the start. This selection 
  1250. can be extended by option-shift-mouse, but not dragged further.
  1251.  
  1252. The rectangular selection can be deleted, copied, and pasted. This is very 
  1253. useful for tables and arrays, such as in LaTeX. Usually, the operation 
  1254. will be intuitive. However, if you use proportional fonts the selection 
  1255. may appear ragged. If some of the line contain tabs, the result may not be 
  1256. want you want. Converting tabs to spaces in the desired region before 
  1257. attempting rectangular selection usually fixes the problems. 
  1258.  
  1259. The most natural semantics of rectangular selection aren't obvious. I 
  1260. chose to implement it in a similar fashion to that of Microsoft Word. 
  1261. Preditor does it in another way, and has many bugs (and it's  commercial, 
  1262. hah!).
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277. =============================================================================
  1278. == Using LaTeX
  1279. =============================================================================
  1280.  
  1281.  
  1282. As I am starting to write papers on my Mac using OzTeX, Alpha may migrate 
  1283. increasingly into the realm of LaTeX users. For starters, LaTeX support 
  1284. includes:
  1285.  
  1286. • automatic word-wrapping.
  1287. • fill paragraph and fill region commands.
  1288. • support for changing paragraph definitions 
  1289.    so that a backslash limits paragraph extent.
  1290. • rectangular editing mode, useful for working
  1291.    with tables and arrays.
  1292. • title-bar section menu.
  1293. • suffix hook for .tex (see the section on suffix 
  1294.    hooks) that can automatically enable all this.
  1295.  
  1296. The only one of the above items that hasn't been explained is the title-bar 
  1297. section menu, which is specified by appropriate settings of 'funcExpr', 
  1298. 'funcPar', and the function 'winFuncTitle'.  For files ending in ".tex", 
  1299. the title-bar contains a box labeled "Sect".  Clicking on this box creates 
  1300. a popup menu containg all section definitions in the current file.  
  1301. Selecting one puts the cursor at the beginning of the section.  See the 
  1302. Popup Menus section and the startup files for more information.
  1303.  
  1304. In addition, distributions from 5.0 on include a ``latex.tcl'' file that 
  1305. has many useful latex'ing macros.  Finally, 
  1306. "public/Alpha/contrib/smart.tcl" on cs.rice.edu contains macros that 
  1307. implement smart quotes.  By default, this file is loaded when latex.tcl is 
  1308. loaded.
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317. =============================================================================
  1318. == The (Dreaded) Option Key
  1319. =============================================================================
  1320.  
  1321.  
  1322. ALPHA's default setup uses the command key like any other mac application. 
  1323. Problems arise in ALPHA's emulation of emacs key bindings. Emacs uses an 
  1324. escape key and a control key.  Alpha's default configuration is set up for 
  1325. Mac II's. Emacs's escape and control keys are emulated by the Mac's 
  1326. corresponding keys. For Mac+'s, however, the situation is much more 
  1327. complicated. They don't have an escape key, so the the backquote key, '`', 
  1328. must be used instead. This can be set up by uncommenting the appropriate 
  1329. line in the "AlphaBits.tcl" file. Also, Mac+'s don't have control keys, so 
  1330. the option key can be used instead.  However....
  1331.  
  1332. Using the option key isn't quite that simple. First, the option key is 
  1333. already used in two contexts. There may be other option bindings. Also, if 
  1334. the variable 'optionIsEscape' is set, the option key is treated as if it 
  1335. is an escape so as to allow single keystroke calls of Alpha functions. In 
  1336. order to use the option key as an escape key, this variable must be set to 
  1337. zero in the AlphaBits file. Also, all the relevant bindings must have 
  1338. their modifier strings changed from using 'z' to 'o'.
  1339.  
  1340. There are other problems. Several option combinations are "dead keys" 
  1341. (option-e, option-o....), they are used to create bizarre (sorry to y'all 
  1342. non-Amuricans) characters through multiple keystrokes. Alpha can fix this 
  1343. by overlaying the system 'KCHR' resource with a private modified resource. 
  1344. This happens at startup time if the "AlphaBits.tcl" file specifies a zero 
  1345. value for the variable 'noRemapOption'. Unfortunately, this is just a US 
  1346. version of the resource, it won't work "fur the non-Amuricans".
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358. =============================================================================
  1359. == System Software 7.0
  1360. =============================================================================
  1361.  
  1362. Alpha is 32-bit clean and high-level event aware. 
  1363.  
  1364. Under 7.0, Alpha uses temporary memory to accommodate large files. This 
  1365. allows you to open multi-megabyte files even when Alpha's partition is set 
  1366. only at 512k, if the system has that much memory available. Note that 
  1367. using temporary memory makes that much memory unavailable to other 
  1368. applications. Contrary to all admonishments, Alpha does not unlock 
  1369. temporary memory across WaitNextEvent calls and may eventually use all the 
  1370. memory in your system. You can turn this feature off through 'tempMem'.
  1371.  
  1372. Note, however, that the clipboard is allocated by the system in Alpha's 
  1373. heap, and therefore cannot take advantage of temporary memory.
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.  
  1394.  
  1395. =============================================================================
  1396. == Apple Events
  1397. =============================================================================
  1398.  
  1399. See the Help file on AppleEvents.
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431. =============================================================================
  1432. == MPW
  1433. =============================================================================
  1434.  
  1435. Alpha's 'dosc' capability (see the function "dosc") can be used to send 
  1436. events to MPW's ToolServer. Using about ten lines of C code and the ~40 
  1437. lines of Tcl code in 'mpw.tcl', I created a pseudo mpw shell (look under 
  1438. the "Misc" menu). This shell uses Alpha's 'dosc' function to package each 
  1439. shell command up into an Apple Event and send it to the ToolServer, which 
  1440. then evaluates the command and returns the result to be displayed in the 
  1441. shell. I'm rather new to Apple Events and the ToolServer, so there are 
  1442. probably a few rough edges. 
  1443.  
  1444. If anyone has extensive docs for ToolServer I'd appreciate looking at them. 
  1445. I only have the application because I am a beta tester for another product 
  1446. that supports ToolServer. I was given the application for the beta testing, 
  1447. but not any docs. And of course, I can *not* give away copies of 
  1448. ToolServer because it is a licensed Apple product.
  1449.  
  1450. Finally, Tom Moertel (thor@vivaldi.psu.edu) has written and provided a set 
  1451. of tools that make life easier while writing code in Alpha for the MPW 
  1452. environment. The tools make extensive use of Apple Events, so you must be 
  1453. using MPW 3.3a or greater. (Earlier versions cannot receive commands via 
  1454. Apple Events.) 
  1455.  
  1456.   With the MPW-Alpha package you can:
  1457.   
  1458.     o  Send TCL commands to Alpha from MPW
  1459.     o  Use MPW 411 from Alpha for instant access to programming help
  1460.     o  Automagically locate source code errors from your last MPW compile
  1461.     o  Use the MPW CDent tool to reformat (grind) C/C++ source code
  1462.        from within Alpha
  1463.  
  1464. This package is available via anonymous ftp from cs.rice.edu.
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481. =============================================================================
  1482. == File Formats
  1483. =============================================================================
  1484.  
  1485.  
  1486. Alpha reads and writes files stored in three (or maybe four) different 
  1487. formats. The three main formats are mac (lines end with a carriage 
  1488. return), unix (lines end with linefeed), and IBM pc (lines end with both 
  1489. carriage return and linefeed. Typical, isn't it?).
  1490.  
  1491. Alpha will transparently read and write all three of these formats. You 
  1492. don't have to do anything special to use different formats, but the 
  1493. 'SaveAs...' dialog allows you to specify the format that a file is written 
  1494. in through the 'Format' button.
  1495.  
  1496. The fourth file format is just a modification of the ordinary mac format. 
  1497. Word processors such as Microsoft Word and MacWrite only put carriage 
  1498. returns at the end of paragraphs, so that they can wrap  the paragraphs on 
  1499. the fly. This is what is referred to as 'paragraph format' in the rest of 
  1500. the help text. Alpha does not transparently convert to and from this 
  1501. format because there are valid reasons why someone might want to edit a 
  1502. paragraph formatted file while not in paragraph mode. 
  1503.  
  1504. Therefore, when Alpha detects reads a paragraph-mode file, it asks the 
  1505. user whether or not to remap it. Files can be mapped back to paragraph 
  1506. mode by setting 'fillColumn' to a very large number and executing 
  1507. 'fillRegion' on the text.
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518. =============================================================================
  1519. == Printing
  1520. =============================================================================
  1521.  
  1522. The current window is printed through the "Page Setup..." and "Print..." 
  1523. File menu items. The variable 'suppressHeader' controls whether a header 
  1524. is printed on each page, 'leftMargin', 'topMargin', and 'bottomMargin' 
  1525. control margins on the printed page.
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555. =============================================================================
  1556. == Tips and other Miscellaneous Diversions...
  1557. =============================================================================
  1558.  
  1559.  
  1560. • When a window is "dirty" (has unsaved changes), a 
  1561.   diamond appears in the title bar and next to the
  1562.   corresponding item in the Windows menu.
  1563.  
  1564. • All dialogs that have editable text can use the Cut, 
  1565.   Copy, and Paste menu command equivalents.
  1566.  
  1567. • In all dialogs, non-editable controls can be selected 
  1568.   by typing Command-<first char of control>. If there 
  1569.   are no editable controls in the dialog, simply typing 
  1570.   the first letter of the desired control suffices.
  1571.  
  1572. • Dirty windows are marked with a diamond in the 
  1573.   window's title bar. The corresponding menu items in 
  1574.   the 'Window' menu will also have a diamond mark next 
  1575.   to it.
  1576.  
  1577. • Set the flag 'undoOn' to 0 in order to speed up long 
  1578.   replace-all and macro modifications.
  1579.  
  1580. • After a piece of text has been yank'd or paste'd, the 
  1581.   'mark' is set to the beginning of the new text and the
  1582.   selection is at the end. 'markHilite' will now hilite 
  1583.   the entire insertion. This is especially useful when
  1584.   moving code. Cut the code, insert at a new position,
  1585.   select the inserted text by selecting "Edit:Hilite", and 
  1586.   then use "Edit:Shift Left" and "Edit: Shift Right" to move
  1587.   the text to the proper indentation.
  1588.  
  1589.  
  1590.  
  1591.  
  1592. ============================================================================= 
  1593. == Variables 
  1594. ============================================================================= 
  1595.  
  1596. There are two different kinds of variables in the Alpha world. These are 
  1597. internal variables and Tcl variables. You can only directly access the 
  1598. latter. However, the internal variables can be modified by creating a Tcl 
  1599. variable of the same name and "binding" it to its internal counterpart via 
  1600. the 'shadowVar' command (See the "Alpha Tcl Extensions" file under the 
  1601. "Help" menu for 'shadowVar's syntax). The following is a listing of the 
  1602. internal variables that can be bound using 'shadowVar': 
  1603.  
  1604. autoSave       • If TRUE, buffers (except untitled buffers) are automatically
  1605.                  saved every 'changesLim' changes.
  1606. backDir           • Directory in which to store backup files.
  1607. backSuffix     • Suffix to append to backup files.
  1608. backup         • if TRUE, the default Tcl proc 'saveHook' makes a backup 
  1609.                  of a file before the data is written. The default backup scheme has 
  1610.                  extension "~".
  1611. blockCursor    • if true, Alpha uses a block cursor instead of a vertical 
  1612.                  line. 
  1613. bwWindows      • if true, Alpha will use 1-bit windows
  1614.                  even if color is available. This speeds
  1615.                  refresh quite a bit on slow color 
  1616.                  machines such as the IIsi.
  1617. changesLim     • number of changes to a window before 
  1618.                  garbage collection or autosave is done.
  1619. currFileSet    • name of currently selected file set.
  1620. defaultFont    • font to use on new windows and files 
  1621.                  which don't have associated font 
  1622.                  specification resources.
  1623. defHeight      • If 'fullScreen' set, this is default 
  1624.                  height in pixels.
  1625. defWidth       • If 'fullScreen' set, this is default 
  1626.                  width in pixels.
  1627. elecLBrace     • Electric 'C' left brace on.
  1628. elecRBrace     • Electric 'C' right brace on.
  1629. electricSemi   • Electric 'C' semicolon on.
  1630. fillColumn     • Number of columns use as limit for
  1631.                  "fill" routines. See 'leftFillColumn'
  1632. fontSaving     • if '-1', Alpha never saves font info,
  1633.                  if '1', Alpha always saves font info,
  1634.                  '0', Alpha saves font info if the font
  1635.                  or size is different than the default.
  1636. fontSize       • Default size of fonts used to display 
  1637.                  files.
  1638. fullNames      • Windows display pathnames instead of 
  1639.                  mere file names.
  1640. fullScreen     • If on, all windows are start in the 
  1641.                  same place, and have the dimension 
  1642.                  specified by 'defHeight' and 
  1643.                  'defWidth'.
  1644. funcPar        • Used in defining the "Func" title-bar menu, see Alpha 
  1645.                    help.
  1646. funcExpr       • Set to the regular expression that 
  1647.                  ALPHA uses to find function 
  1648.                  declarations.
  1649. funcTitle      • Text to put in title-bar menu header.
  1650.                  See the Popup-Menus section for more
  1651.                  information.
  1652. horScrollBar   • If set, use horizontal scrollbar.
  1653. includePath    • A list of the path-names of the 
  1654.                  directories to search for include 
  1655.                  files, separated by semi-colons, such
  1656.                  as:
  1657.                    "Disk:C:edit;Disk:C:THINK C:include;"
  1658.                  The current directory can be included
  1659.                  by using consecutive semi-colons as:
  1660.                  "Disk:C:edit;Disk:C:THINK C:inc;;"
  1661. indentOnCR     • Auto-indent on carriage return.
  1662. leftFillColumn • Number of blanks left at beginning of 
  1663.                  lines by 'fill' routines. 
  1664. markLabel       • If a window is opened through either 'edit' or 'fileMenu' 
  1665.                  and the '-m' option was set, this string is used as the label of the 
  1666.                  marks menu.
  1667. markSorting       • Controls the order in which marks are saved into a file. 
  1668.                  '0' means the order in which they are defined, '1' means file 
  1669.                  order, and '2' means alphabetical order.
  1670. moveInsertion  • if true, 'pageBack' and 'pageForward'
  1671.                  move the insertion point
  1672. numWinsToTile  • specifies the number of windows tile
  1673.                  commands should affect.
  1674. openAllFIles   • if true, or it option key down, files 
  1675.                  of all types are openable, not just
  1676.                  'TEXT'.
  1677. optionIsMeta   • If set, the key combination with escape
  1678.                  is used instead of the option key
  1679.                  combination. Note that some 
  1680.                  combinations with option chars are
  1681.                  dead keys.
  1682. paraColumn     • Alpha automatically wraps files
  1683.                 that contains lines longer than this. 
  1684. posActivate    • If true, then merely moving the mouse
  1685.                  over a window activates. For those
  1686.                  X11-twm lovers.
  1687. powerThumb       • If true, vertical scrollbars have power thumbs.
  1688. protoFile      • name of file to dump prototypes into.
  1689. replaceStr       • Text for the search and replace functions.
  1690. savedState       • set to either "mpw", "think", or "none" depending on how 
  1691.                  much information you wish Alpha to save in the resource fork of the 
  1692.                  files you edit. See the "Files" section of this file for more 
  1693.                  information.
  1694. searchStr       • Text for the search and replace functions.
  1695. showRowCol     • if set, row and col are continuously
  1696.                  displayed in the title bar. 
  1697. showMenuHeads  • If set, the function and mark menus can 
  1698.                  be selected from the title bar.
  1699. intelCutPaste  • If enabled, cut and paste routines try to 
  1700.                  intelligently treat surrounding white space.
  1701. sortColumn     • column to use for sort routine.
  1702. sortedIsDefault• if set, sorted is the default for 
  1703.                  function and section menus.
  1704. suppressHeader • Suppress header on printed pages.
  1705. tabSize        • Default number of characters per tab.
  1706. tagFile        • complete path-name of tag file
  1707. tempMem        • if zero, Alpha will not use temporary
  1708.                  memory.
  1709. undoOn         • used to turn undo on and off. When undo
  1710.                  is turned off, all undo info is lost.
  1711.                  Useful when doing global replaces, etc.
  1712. wordBreak       • Regular expression used to defines words for all internal 
  1713.                  operations. 
  1714. wordBreakPreface • Prepended to 'wordBreak' when looking backwards for a 
  1715.                  word. See the "Word Break" section of this file for more 
  1716.                  information.
  1717. wordWrap       • if true, lines exceeding 'fillColumn'
  1718.                  in length are automatically wrapped
  1719.                  during normal text insertion (typing)
  1720.  
  1721.  
  1722.  
  1723. ================================================================================
  1724. == Spellchecking
  1725. ================================================================================
  1726.  
  1727. Alpha has the capability to interact with the spell-check 'Excalibur', 
  1728. written by Robert Gottshall and Rick Zaccone.  The menu item 'Spellcheck 
  1729. Window' is always available in either the menu w/ Excalibur's icon, or 
  1730. under the Latex menu (with the OzTex menu).  Selecting this item will start 
  1731. up Excalibur and send an OpenDoc event describing the current window.  For 
  1732. version 1.4 and earlier, if Alpha has to launch Excalibur you will need to 
  1733. dismiss Excalibur's opening dialog by hitting the Cancel button.  
  1734. Subsequent selections of the menu item will switch right into Excalibur 
  1735. with the correct file displayed.  In future versions, this will become even 
  1736. more automatic.
  1737.  
  1738. Excalibur is free, but not in the public domain.  It can be obtained from 
  1739. all the usual Internet ftp sites, as well as cs.rice.edu under 
  1740. public/Alpha.
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761. ===========================================================================
  1762. == INTERNATIONAL USERS
  1763. ===========================================================================
  1764. Remember, if you want to use anything other than the US KCHR resource 
  1765. (si vous voulez ecrire en francais, par exemple), change the line:
  1766.  
  1767.  init 0 2
  1768.  
  1769. of :Tcl:SystemCode:AlphaBits.tcl to
  1770.  
  1771.  init1 2
  1772.  
  1773. and restart. Alpha will now use your native KCHR, but the key binding labels
  1774. (such as F1 etc.) may not work, and option-e etc. are now "dead keys". 
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804. ===========================================================================
  1805. == Drag and Drop Editing
  1806. ===========================================================================
  1807.  
  1808. Alpha supports drag and drop cut, copy, clear, and paste. To use this 
  1809. feature, select some text, then move the cursor over the selected text. 
  1810. The cursor should then turn into an open hand. Mouse down, and move the 
  1811. cursor to the place you wish to paste the text. When the mouse is 
  1812. released, the hilited text is moved to the new location.
  1813.  
  1814. Option-mouse does a "copy" instead. Dragging the cursor from the selected 
  1815. text off the edge of the window will clear it.
  1816.  
  1817. Alpha does not currently support drag and drop editing between windows or 
  1818. files. 
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.